package com.hengpeng.common.monitor.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.hengpeng.common.web.annotation.HtmlInput;
import com.hengpeng.common.web.annotation.HtmlInputPattern;
import com.hengpeng.common.web.annotation.HtmlInputType;

/**
 * <pre>
 * 服务器状态
 * </pre>
 * @author linriqing
 * @version 1.0, 2012-12-21
 */
public class ServerStatus implements Serializable
{
	public static class DiskStatus implements Serializable
	{
		private static final long serialVersionUID = 4308252045942659539L;

		@HtmlInput(label = "磁盘可用容量", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.INT)
		private long freeSpace;

		@HtmlInput(label = "磁盘总容量", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.INT)
		private long totalSpace;

		@HtmlInput(label = "磁盘名称", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.NORMAL)
		private String name;

		/**
		 * @return 磁盘名称
		 */
		public String getName()
		{
			return name;
		}

		/**
		 * 构造函数
		 * @param freeSpace 可用空间
		 * @param totalSpace 总容量
		 */
		public DiskStatus(String name, long freeSpace, long totalSpace)
		{
			super();
			this.name = name;
			this.freeSpace = freeSpace;
			this.totalSpace = totalSpace;
		}

		/**
		 * @return 可用空间
		 */
		public long getFreeSpace()
		{
			return freeSpace;
		}

		/**
		 * @return 总容量
		 */
		public long getTotalSpace()
		{
			return totalSpace;
		}
	}

	private static final long serialVersionUID = -8328343961192568431L;

	@HtmlInput(label = "磁盘空间使用状态", type = HtmlInputType.CHECKBOX, labelProperty = "name", nullable = false)
	private List<DiskStatus> diskStatus = new ArrayList<DiskStatus>();

	@HtmlInput(label = "空闲内存", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.FLOAT)
	private double freeMemory;

	@HtmlInput(label = "空闲交换内存", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.INT)
	private long freeSwapSpace;

	@HtmlInput(label = "服务器IP地址", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.IP)
	private String hostIP;

	@HtmlInput(label = "服务器名称", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.NORMAL)
	private String hostName;

	@HtmlInput(label = "服务器CPU负载", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.FLOAT)
	private double loadAverage;

	@HtmlInput(label = "服务器系统架构", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.NORMAL)
	private String osArch;

	@HtmlInput(label = "服务器系统名称", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.NORMAL)
	private String osName;

	@HtmlInput(label = "服务器系统版本", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.NORMAL)
	private String osVersion;

	@HtmlInput(label = "处理器个数", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.INT)
	private int processorCount;

	@HtmlInput(label = "总共内存大小", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.FLOAT)
	private double totalMemory;

	@HtmlInput(label = "总共交换内存大小", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.INT)
	private long totalSwapSpace;

	@HtmlInput(label = "虚拟内存", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.INT)
	private long virtualMemory;

	/**
	 * @return diskStatus
	 */
	public List<DiskStatus> getDiskStatus()
	{
		return diskStatus;
	}

	/**
	 * @return freeMemory
	 */
	public double getFreeMemory()
	{
		return freeMemory;
	}

	/**
	 * @return freeSwapSpace
	 */
	public long getFreeSwapSpace()
	{
		return freeSwapSpace;
	}

	/**
	 * @return hostIP
	 */
	public String getHostIP()
	{
		return hostIP;
	}

	/**
	 * @return hostName
	 */
	public String getHostName()
	{
		return hostName;
	}

	/**
	 * @return loadAverage
	 */
	public double getLoadAverage()
	{
		return loadAverage;
	}

	/**
	 * @return osArch
	 */
	public String getOsArch()
	{
		return osArch;
	}

	/**
	 * @return osName
	 */
	public String getOsName()
	{
		return osName;
	}

	/**
	 * @return osVersion
	 */
	public String getOsVersion()
	{
		return osVersion;
	}

	/**
	 * @return processorCount
	 */
	public int getProcessorCount()
	{
		return processorCount;
	}

	/**
	 * @return totalMemory
	 */
	public double getTotalMemory()
	{
		return totalMemory;
	}

	/**
	 * @return totalSwapSpace
	 */
	public long getTotalSwapSpace()
	{
		return totalSwapSpace;
	}

	/**
	 * @return virtualMemory
	 */
	public long getVirtualMemory()
	{
		return virtualMemory;
	}

	/**
	 * @param diskStatus diskStatus
	 */
	public void setDiskStatus(List<DiskStatus> diskStatus)
	{
		this.diskStatus = diskStatus;
	}

	/**
	 * @param freeMemory freeMemory
	 */
	public void setFreeMemory(double freeMemory)
	{
		this.freeMemory = freeMemory;
	}

	/**
	 * @param freeSwapSpace freeSwapSpace
	 */
	public void setFreeSwapSpace(long freeSwapSpace)
	{
		this.freeSwapSpace = freeSwapSpace;
	}

	/**
	 * @param hostIP hostIP
	 */
	public void setHostIP(String hostIP)
	{
		this.hostIP = hostIP;
	}

	/**
	 * @param hostName hostName
	 */
	public void setHostName(String hostName)
	{
		this.hostName = hostName;
	}

	/**
	 * @param loadAverage loadAverage
	 */
	public void setLoadAverage(double loadAverage)
	{
		this.loadAverage = loadAverage;
	}

	/**
	 * @param osArch osArch
	 */
	public void setOsArch(String osArch)
	{
		this.osArch = osArch;
	}

	/**
	 * @param osName osName
	 */
	public void setOsName(String osName)
	{
		this.osName = osName;
	}

	/**
	 * @param osVersion osVersion
	 */
	public void setOsVersion(String osVersion)
	{
		this.osVersion = osVersion;
	}

	/**
	 * @param processorCount processorCount
	 */
	public void setProcessorCount(int processorCount)
	{
		this.processorCount = processorCount;
	}

	/**
	 * @param totalMemory totalMemory
	 */
	public void setTotalMemory(double totalMemory)
	{
		this.totalMemory = totalMemory;
	}

	/**
	 * @param totalSwapSpace totalSwapSpace
	 */
	public void setTotalSwapSpace(long totalSwapSpace)
	{
		this.totalSwapSpace = totalSwapSpace;
	}

	/**
	 * @param virtualMemory virtualMemory
	 */
	public void setVirtualMemory(long virtualMemory)
	{
		this.virtualMemory = virtualMemory;
	}

}
